﻿@model IEnumerable<Bk.Models.BlogInfo>

@{
    ViewBag.Title = "搜索结果";
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>搜索结果 - @ViewBag.SearchTerm</title>
    <!-- 引入与首页相同的样式 -->
    <style>
        /* 复制首页的全部CSS代码到这里 */
        /* ... */
    </style>
</head>
<body>
    <!-- 复制首页的头部导航部分 -->
    <div class="container">
        <div class="row">
            <div id="head" class="col-12 col-md-6 col-lg-4">
                    <img class="left" src="~/Image/logo.png" />
                    <form action="@Url.Action("SearchResults", "Home")" method="get">
                        <input class="right" type="text" name="term" value="@ViewBag.SearchTerm" />
                        <button type="submit" class="fancyButton">搜索</button>
                    </form>
                <span>
                    <input id="fancyButton" type="button" value="个人" onclick="Usersinfo()" />
                    @*<a href="@Url.Action("Create", "home")">创作⊕</a>*@
                </span>
            </div>
        </div>
    </div>

    <div class="center_one">
        <ul class="nav col-12 col-md-6 col-lg-4">
            <li><a href="@Url.Action("Index","Default")">全部</a></li>
            <li><a href="@Url.Action("Art","Default")">艺术</a></li>
            <li><a href="@Url.Action("WX","Default")">文学</a></li>
            <li><a href="@Url.Action("Sports","Default")">体育</a></li>
            <li><a href="@Url.Action("Life","Default")">生活</a></li>
        </ul>
    </div>

    <!-- 搜索结果区域 -->
    <div class="container mt-5">
        <h1 class="text-center mb-4">搜索结果: @ViewBag.SearchTerm</h1>

        @if (Model.Any())
        {
            <div class="row">
                @foreach (var blog in Model)
                {
                    <div class="col-md-4 mb-4">
                        <div class="card">
                            <img src="~/Image/thumbnail.jpg" class="card-img-top" alt="Blog thumbnail" />
                            <div class="card-body">
                                <h5 class="card-title">@blog.Title</h5>
                                <p class="card-text">@blog.Content.Truncate(150)</p>
                                <a href="#" class="btn btn-primary">查看详情</a>
                            </div>
                        </div>
                    </div>
                }
            </div>
        }
        else
        {
            <div class="text-center py-5">
                <h3>没有找到相关结果</h3>
                <p>请尝试使用不同的关键词或检查拼写</p>
            </div>
        }
    </div>

    <!-- 引入与首页相同的JavaScript -->
    <script>
        // 复制首页的全部JavaScript代码到这里
        // ...

        // 保留Usersinfo函数
        function Usersinfo() {
            var users = '@Url.Action("Person", "Home")';
            window.location.href = users;
        }
    </script>
</body>
</html>